package com.conversationboard.mobile;

import javax.servlet.http.HttpServletRequest;

public class MobileDevice {

	private static String[] mobileDevices = { "sonyericsson", "motorola", "nokia", "smartphone", "iphone" };


	public static boolean isMobileDevice(HttpServletRequest request) {

		String agent = request.getHeader("User-Agent");

		if (agent == null) {
			return false;
		}

		agent = agent.toLowerCase();

		for (String mobileDevice : mobileDevices) {
			if (agent.contains(mobileDevice)) {
				return true;
			}
		}

		return false;
	}

}
